package com.irdstudio.rsp.rule.api.rest;

import com.irdstudio.rsp.rule.service.facade.BizRuleLogDetailService;
import com.irdstudio.rsp.rule.service.vo.BizRuleLogDetailVO;
import com.irdstudio.sdk.beans.core.vo.ResponseData;
import com.irdstudio.sdk.beans.web.controller.AbstractController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api")
public class BizRuleLogDetailController extends AbstractController  {
	
	@Autowired
	@Qualifier("bizRuleLogDetailServiceImpl")
	private BizRuleLogDetailService bizRuleLogDetailService;

	
	/**
	 * 列表数据查询
	 * @param page
	 * @param size
	 * @return
	 */
	@RequestMapping(value="/biz/rule/log/details", method=RequestMethod.POST)
	public @ResponseBody ResponseData<List<BizRuleLogDetailVO>> queryBizRuleLogDetailAll(
			BizRuleLogDetailVO vo) {		
		List<BizRuleLogDetailVO> outputVo = bizRuleLogDetailService.queryAllOwner(vo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 根据主键查询详情
	 * @return
	 */
	@RequestMapping(value="/biz/rule/log/detail/{logId}/{ruleCollId}", method=RequestMethod.GET)
	public @ResponseBody ResponseData<BizRuleLogDetailVO> queryByPk(@PathVariable("logId") String logId,@PathVariable("ruleCollId") String ruleCollId) {		
		BizRuleLogDetailVO inVo = new BizRuleLogDetailVO();
				inVo.setLogId(new String(logId));
				inVo.setRuleCollId(new String(ruleCollId));
		BizRuleLogDetailVO outputVo = bizRuleLogDetailService.queryByPk(inVo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 根据主键删除信息
	 * @param bizRuleLogDetail
	 * @return
	 */
	@RequestMapping(value="/biz/rule/log/detail", method=RequestMethod.DELETE)
	public @ResponseBody ResponseData<Integer> deleteByPk(@RequestBody BizRuleLogDetailVO inBizRuleLogDetailVo) {		
		int outputVo = bizRuleLogDetailService.deleteByPk(inBizRuleLogDetailVo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 根据主键更新信息
	 * @param inBizRuleLogDetailVo
	 * @return
	 */
	@RequestMapping(value="/biz/rule/log/detail", method=RequestMethod.PUT)
	public @ResponseBody ResponseData<Integer> updateByPk(@RequestBody BizRuleLogDetailVO inBizRuleLogDetailVo) {		
		int outputVo = bizRuleLogDetailService.updateByPk(inBizRuleLogDetailVo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 新增数据
	 * @param inBizRuleLogDetailVo
	 * @return
	 */
	@RequestMapping(value="/biz/rule/log/detail", method=RequestMethod.POST)
	public @ResponseBody ResponseData<Integer> insertBizRuleLogDetail(@RequestBody BizRuleLogDetailVO inBizRuleLogDetailVo) {
		int outputVo = bizRuleLogDetailService.insertBizRuleLogDetail(inBizRuleLogDetailVo);
		return getResponseData(outputVo);
		
	}
}
